import time

import page
from base.base import Base


class WebPageOrder(Base):
    def page_web_button(self):
        self.base_click(page.web_order_button)

    def page_web_goods(self):
        self.base_click(page.web_order_goods)

    # 切换iframe并发货
    def page_web_deliver(self):
        self.base_switch_frame(page.web_order_iframe)
        self.base_click(page.web_order_deliver)

    def page_web_company(self):
        self.base_click(page.web_order_company)

    def page_web_order_on(self):
        text  = str(time.strftime("%Y%m%d%H%M%S"))
        self.base_input(page.web_order_order_no, text)

        # 确认发货

    def page_order_goods_ok(self):
        self.base_click(page.web_order_goods_ok)

        # 打印配置单

    def page_order_print_order(self):
        self.base_click(page.web_order_print_order)

        # 获取订单编号

    def page_order_get_on(self):
        return self.base_get_text(page.web_order_on)

#     结合
    def page_web_order(self):
        self.page_web_button()
        self.page_web_goods()
        self.page_web_deliver()
        self.page_web_company()
        self.page_web_order_on()
        self.page_order_goods_ok()
        self.page_order_print_order()





if __name__ == '__main__':
    text = str(time.strftime("%Y%m%d%H%M%S"))
    print(text)
    """
    # web订单处理
# 订单按钮点击
web_order_button = By.XPATH, "//a[text()='订单']"
# 点击发货单
web_order_goods = By.XPATH, "//a[text()='发货单']"
# 切换iframe
web_order_iframe = By.CSS_SELECTOR, "#workspace"
# 去发货
web_order_deliver = By.XPATH, "//a[text()='去发货']"
# 物流公司
web_order_company = By.CSS_SELECTOR, "[value='YZPY']"
# 配送单号
web_order_order_no = By.CSS_SELECTOR, "#invoice_no"
# 确认发货
web_order_goods_ok = By.CSS_SELECTOR, ".ncap-btn-send"
# 打印配置单
web_order_print_order = By.CSS_SELECTOR, ".fa-print"
# 获取订单编号
web_order_on = By.XPATH, "//div[@class='misc-info']/dl[1]/dd[1]"
    """